package com.pig4cloud.pig.village.reward.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.pig.village.api.entity.RewardSolution;
import com.pig4cloud.pig.village.reward.mapper.RewardSolutionMapper;
import com.pig4cloud.pig.village.reward.service.IRewardSolutionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

/**
 * @author limbray.li
 * @date 2021/6/26
 */
@Service
@Slf4j
public class RewardSolutionServiceImpl extends ServiceImpl<RewardSolutionMapper, RewardSolution> implements IRewardSolutionService {
	@Override
	public List<RewardSolution> getSolutions(Collection<Long> eventIds, Collection<Long> rewardIds) {
		LambdaQueryWrapper<RewardSolution> query = Wrappers.lambdaQuery();
		query.in(CollectionUtils.isNotEmpty(eventIds), RewardSolution::getEventId, eventIds);
		query.in(CollectionUtils.isNotEmpty(rewardIds), RewardSolution::getInfoId, rewardIds);
		return super.list(query);
	}
}
